package com.example.administrator.yuejian2.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.example.administrator.yuejian2.activity.MyFragment;
import com.example.administrator.yuejian2.fragment.ActivityFragment;
import com.example.administrator.yuejian2.fragment.ClubFragment;
import com.example.administrator.yuejian2.fragment.TrainFragment;

public class mFragmentPagerAdapter extends FragmentPagerAdapter{


    private ClubFragment clubFragment;
    private TrainFragment trainFragment;
    private ActivityFragment activityFragment;
    public mFragmentPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        switch (position)
        {
            case 0:  clubFragment=new ClubFragment();
                return clubFragment;

            case 1: trainFragment =new TrainFragment();
                return trainFragment;

            case 2: activityFragment =new ActivityFragment();
                return activityFragment;

            case 3: trainFragment =new TrainFragment();
                return trainFragment;

                default:return null;
        }


    }
    @Override
    public CharSequence getPageTitle(int position) {     //返回Tab名字
        String name ="Tag"+position;
        return  name;
    }

    @Override
    public int getCount() {
        return 4;
    }
}
